﻿using banyuetan_2_0.Common.Enum;
using SqlSugar;
using System;
using System.Collections.Generic;

namespace banyuetan_2_0.Model.Models
{
    /// <summary>
    /// 资源表
    /// </summary>
    public class Source
    {
        /// <summary>
        /// ID
        /// </summary>
        [SugarColumn(IsNullable = false, IsPrimaryKey = true)]
        public int sId { get; set; }
        /// <summary>
        /// 文件名称
        /// </summary>
        [SugarColumn(ColumnDataType ="nvarchar",Length =50,IsNullable =false)]
        public string sName { get; set; }
        /// <summary>
        /// 文件路径
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = false)]
        public string sPath { get; set; }
        /// <summary>
        /// 文件类型
        /// </summary>
        [SugarColumn(IsNullable =false,ColumnDataType ="int")]
        public FileType sType { get; set; } = FileType.Picture;
        /// <summary>
        /// 是否有缩略图
        /// </summary>
        [SugarColumn(IsNullable =true)]
        public bool sHasMini { get; set; } = false;
        /// <summary>
        /// 缩略图路径
        /// </summary>
        [SugarColumn(IsNullable =true)]
        public string sMiniPath { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime sUpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// Article导航属性
        /// </summary>
        [Navigat(typeof(ArticleAndSource),nameof(ArticleAndSource.sId),nameof(ArticleAndSource.aId))]
        public List<Article> Articles { get; set; }
    }
}
